package eoeProject.edenOfEast.page.analyses.analysesRes.component;

import java.text.SimpleDateFormat;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import eoeProject.edenOfEast.bean.EOEAnalysesBean;

//@AuthorizeInstantiation("ADMIN")
public class AnalysesResDetailPanel extends Panel {
	private static final long serialVersionUID = 1L;

	private EOEAnalysesBean analyses;

	public AnalysesResDetailPanel(String id, EOEAnalysesBean analyses) {
		super(id);

		this.analyses = analyses;
		SimpleDateFormat sdf = new SimpleDateFormat("M月d日 H時m分s秒");
		add(new Label("analysesDetailTitle", analyses.getTitle()));
		add(new Label("analysesDetailCategory", analyses.getCategoryName()));
		add(new MultiLineLabel("analysesDetailAbout", analyses.getAbout()));
		PageParameters parameters = new PageParameters();
		parameters.add("userId", analyses.getCreateUserId());
		BookmarkablePageLink<WebPage> accountLink = new BookmarkablePageLink<WebPage>(
				"accountLink",
				eoeProject.edenOfEast.page.account.accountDetailPage.Index.class,
				parameters);
		accountLink.add(new Label("analysesDetailUser", analyses
				.getCreateUserName()));
		add(accountLink);
		add(new Label("analysesDetailTag1", analyses.getTag1()));
		add(new Label("analysesDetailTag2", analyses.getTag2()));
		add(new Label("analysesDetailTag3", analyses.getTag3()));
		add(new Label("analysesDetailTotalRes", analyses.getTotalRes()
				.toString()));
		add(new Label("analysesDetailCreateDate", sdf.format(analyses
				.getCreateDate())));
		add(new Label("analysesDetailUpdateDate", sdf.format(analyses
				.getUpdateDate())));
	}
}
